package cn.com.oceansoft.business.os.service.impl;

import cn.com.oceansoft.business.base.entity.Pager;
import cn.com.oceansoft.business.base.entity.Query;
import cn.com.oceansoft.business.os.entity.User;
import cn.com.oceansoft.business.os.persistence.ILuckyBoyMapper;
import cn.com.oceansoft.business.os.service.ILuckyBoyService;
import cn.com.oceansoft.nos.common.util.web.PageUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by zhangxl on 2016/12/22.
 */

@Service
public class LuckyBoyServiceImpl implements ILuckyBoyService {

    @Resource
    private ILuckyBoyMapper luckyBoyMapper;

    @Override
    public Pager<User> findByPage(Query query) {
        PageHelper.startPage(query.getPageNum(), query.getNumPerPage(), true);
        Page<User> page = (Page<User>) luckyBoyMapper.find(query);
        return PageUtil.page2pager(page, query);
    }
}
